<?php
	$head->_template_assign("TITEL", (string)$language->titles->value_4);
	switch ($_GET["mode"]){
		case "safe":
			if (file_exists("System/Security/password.txt")){
				if (sha1($_POST["original"]) == file_get_contents("System/Security/password.txt")) {
					if ($_POST["pass1"] == $_POST["pass2"]){
						if (file_put_contents("System/Security/password.txt", sha1($_POST["pass2"]))) {
							oyster_log("SUCCESS", (string)$language->stati->value_1, "Oyster password.include");
							$head->_template_assign("STATUS", (string)$language->stati->value_1);
						} else {
							oyster_log("ERROR", (string)$language->errors->value_6, "Oyster password.include");
							$head->_template_assign("ERROR", (string)$language->errors->value_6);

						}
					} else {
						oyster_log("ERROR", (string)$language->errors->value_7, "Oyster password.include");
						$head->_template_assign("ERROR", (string)$language->errors->value_7);

					}
				} else {
					oyster_log("ERROR", (string)$language->errors->value_8, "Oyster password.include");
					$head->_template_assign("ERROR", (string)$language->errors->value_8);
				}
			} else {
				if (sha1($_POST["pass1"]) == $_POST["pass2"]){
					if (file_put_contents("System/Security/password.txt", sha1($_POST["pass2"]))) {
						oyster_log("SUCCESS", (string)$language->stati->value_1, "Oyster password.include");
						$head->_template_assign("STATUS", (string)$language->stati->value_1);
					} else {
						oyster_log("ERROR", (string)$language->log_msgs->value_5, "Oyster password.include");
						$head->_template_assign("ERROR", (string)$language->errors->value_9);

					}
				} else {
					oyster_log("ERROR", (string)$language->errors->value_7, "Oyster password.include");
					$head->_template_assign("ERROR", (string)$language->errors->value_7);

				}
			}
			include("System/Kernel/Includes/index.include.php");
		break;
		default:
			$template->_template_read("System/Design/Templates/password.html");
			// Grundlegende Sprach-Strings-Einsetzen
			$template->_template_assign("CAPTION_PWD1", (string)$language->common->value_1);
			$template->_template_assign("CAPTION_PWD2", (string)$language->common->value_22);
			$template->_template_assign("CAPTION_PWD3", (string)$language->common->value_23);
			$template->_template_assign("CAPTION_PWD4", (string)$language->common->value_24);
			$template->_template_assign("CAPTION_PWD5", (string)$language->buttons->value_6);
	}
?>